aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/thematique/[slug].tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-17 22:48:41 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-17 22:48:41 +0200
commit271ef6debaca7ed9a01829dcef3a37e90a2dff05 (patch)
treeaa1513b40e7020a44cfcaaedc3a33d39ecfb8af7 /src/pages/thematique/[slug].tsx
parent4e53a8654441481029746ff4e35a4a19c8d83709 (diff)
chore: use persistent layout
It prevents to rerender the common components between pages (header, footer...).
Diffstat (limited to 'src/pages/thematique/[slug].tsx')
-rw-r--r--src/pages/thematique/[slug].tsx15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index 13ef0da..23e6a8b 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -1,6 +1,7 @@
import Heading from '@components/atoms/headings/heading';
import PostsList, { type Post } from '@components/organisms/layout/posts-list';
import LinksListWidget from '@components/organisms/widgets/links-list-widget';
+import { getLayout } from '@components/templates/layout/layout';
import PageLayout, {
type PageLayoutProps,
} from '@components/templates/page/page-layout';
@@ -10,7 +11,12 @@ import {
getThematicsPreview,
getTotalThematics,
} from '@services/graphql/thematics';
-import { type Article, type PageLink, type Thematic } from '@ts/types/app';
+import {
+ type Article,
+ type NextPageWithLayout,
+ type PageLink,
+ type Thematic,
+} from '@ts/types/app';
import { loadTranslation, type Messages } from '@utils/helpers/i18n';
import {
getLinksListItems,
@@ -19,7 +25,7 @@ import {
} from '@utils/helpers/pages';
import useBreadcrumb from '@utils/hooks/use-breadcrumb';
import useSettings from '@utils/hooks/use-settings';
-import { GetStaticPaths, GetStaticProps, NextPage } from 'next';
+import { GetStaticPaths, GetStaticProps } from 'next';
import Head from 'next/head';
import { useRouter } from 'next/router';
import Script from 'next/script';
@@ -33,7 +39,7 @@ export type ThematicPageProps = {
translation: Messages;
};
-const ThematicPage: NextPage<ThematicPageProps> = ({
+const ThematicPage: NextPageWithLayout<ThematicPageProps> = ({
currentThematic,
thematics,
}) => {
@@ -191,6 +197,9 @@ const ThematicPage: NextPage<ThematicPageProps> = ({
);
};
+ThematicPage.getLayout = (page) =>
+ getLayout(page, { useGrid: true, withExtraPadding: true });
+
interface ThematicParams extends ParsedUrlQuery {
slug: string;
}